<?php

namespace App\Http\Requests\GiveUController;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class PreNodeRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'type' => ['required', Rule::in([1, 2])],
            'pay_password' => ['required', "payPassword"],
            'parent_id' => ['required'],
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'type.required' => __('类型必填'),
            'type.in' => __('类型错误'),
            'pay_password.required' => __('交易密码必填'),
            'parent_id.required' => __('请填写邀请码'),
        ];
    }
}
